Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add extension #13

Merged
merged 1 commit into from
Nov 8, 2023
Merged

Feat: add extension #13

merged 1 commit into from
Nov 8, 2023

Conversation

SH0123
Copy link
Collaborator

@SH0123 SH0123 commented Nov 8, 2023

Color+Extension, TextStyleExtension, color asset, font

이슈 번호

🔒 Close #11

구현 / 변경 사항 이유

Added color assets, text styles and fonts for everyone.
You don't have to set font to Text directly and color to text or symbol or etc...

Added this file to make it easier to use Color

extension Color {
    static let background = Color("background")
    static let lightBlue = Color("lightBlue")
}

Added this TextStyle+Extension.swift file to make it easier to use TextStyle.
You can change text color with color argument at font modifier.

struct Display: ViewModifier {
    var color: Color
    
    func body(content: Content) -> some View {
        content
            .foregroundStyle(color)
            .font(.custom("omyu pretty", size: 27))
    }
}

extension View {
    func display(_ color: Color) -> some View {
        self.modifier(Display(color: color))
    }
}

Please use Color and TextStyle as below

// color
Image(systemName: "globe")
                .imageScale(.large)
                .foregroundColor(.lightBlue)

// text style
Text("Hello, world!")
                .display(.black)

References

Custom TextsStyle
Setting Line Height

Color+Extension, TextStyleExtension, color asset, font
@SH0123 SH0123 added the 김상효 김상효 label Nov 8, 2023
@SH0123 SH0123 self-assigned this Nov 8, 2023
@SH0123 SH0123 merged commit 98f878c into develop Nov 8, 2023
1 check passed
@SH0123 SH0123 deleted the Feat/#11_color_extension branch November 8, 2023 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
김상효 김상효
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] Color, TextStyle Extension
1 participant